﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KBVault.Web.Infrastructure;

namespace KBVault.Web.Application
{
    public partial class CategoryOps : KBVaultAdminPage
    {        

        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            if (!Page.IsPostBack)
            {
                if (!String.IsNullOrEmpty(PageOperation) )
                {
                    switch(PageOperation.ToLowerInvariant())
                    {
                        case "list":
                            mvContainer.ActiveViewIndex = 1;                            
                            break;
                        case "new":
                            mvContainer.ActiveViewIndex = 0;
                            break;
                        case "edit":
                            if (ActiveCategoryId > 0)
                            {
                                mvContainer.ActiveViewIndex = 0;
                            }
                            else
                            {
                                mvContainer.ActiveViewIndex = 1;
                            }
                            break;
                        default: break;
                    }
                }
            }
        }
    }
}